from app.services.auth.UserAuth import UserAuth
from app.services.message.FeiShuPost import FeishuMessage
from flask import jsonify


class Params(object):
    def __init__(self, request):
        self.request = request

    def post(self):
        params = self.request.json or self.request.form or {}
        return params

    def get(self):
        params = self.request.args or {}
        return params

    def all(self):
        return self.request.json or self.request.form or self.request.args or {}


class m():
    @staticmethod
    def success(code=0, message=None, data=[]):
        res = {}
        res['code'] = code
        res['status'] = True
        if message: res['message'] = message
        if data: res['data'] = data
        return res

    @staticmethod
    def error(code=0, message=None, data=[]):
        res = {}
        res['code'] = code
        res['status'] = False
        if message: res['message'] = message
        if data: res['data'] = data
        return res

    def __new__(cls, **kwargs):
        return jsonify(kwargs)
